commonlibsse_ng\re\b/
BGSEntryPoint.rs

1use core::{ffi::c_char, ptr::NonNull};
2
3use crate::re::Actor::Actor;
4use crate::re::BGSEntryPointFunction::ENTRY_POINT_FUNCTION_TYPE_CEnum;
5
6#[commonlibsse_ng_derive_internal::ffi_enum]
7#[repr(u32)]
8#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
9pub enum ENTRY_POINT {
10    CalculateWeaponDamage = 0,
11    CalculateMyCriticalHitChance = 1,
12    CalculateMyCriticalHitDamage = 2,
13    CalculateMineExplodeChance = 3,
14    AdjustLimbDamage = 4,
15    AdjustBookSkillPoints = 5,
16    ModRecoveredHealth = 6,
17    GetShouldAttack = 7,
18    ModBuyPrices = 8,
19    AddLeveledListOnDeath = 9,
20    GetMaxCarryWeight = 10,
21    ModAddictionChance = 11,
22    ModAddictionDuration = 12,
23    ModPositiveChemDuration = 13,
24    Activate = 14,
25    IgnoreRunningDuringDetection = 15,
26    IgnoreBrokenLock = 16,
27    ModEnemyCriticalHitChance = 17,
28    ModSneakAttackMult = 18,
29    ModMaxPlaceableMines = 19,
30    ModBowZoom = 20,
31    ModRecoverArrowChance = 21,
32    ModSkillUse = 22,
33    ModTelekinesisDistance = 23,
34    ModTelekinesisDamageMult = 24,
35    ModTelekinesisDamage = 25,
36    ModBashingDamage = 26,
37    ModPowerAttackStamina = 27,
38    ModPowerAttackDamage = 28,
39    ModSpellMagnitude = 29,
40    ModSpellDuration = 30,
41    ModSecondaryValueWeight = 31,
42    ModArmorWeight = 32,
43    ModIncomingStagger = 33,
44    ModTargetStagger = 34,
45    ModAttackDamage = 35,
46    ModIncomingDamage = 36,
47    ModTargetDamageResistance = 37,
48    ModSpellCost = 38,
49    ModPercentBlocked = 39,
50    ModShieldDeflectArrowChance = 40,
51    ModIncomingSpellMagnitude = 41,
52    ModIncomingSpellDuration = 42,
53    ModPlayerIntimidation = 43,
54    ModPlayerReputation = 44,
55    ModFavorPoints = 45,
56    ModBribeAmount = 46,
57    ModDetectionLight = 47,
58    ModDetectionMovement = 48,
59    ModSoulGemRecharge = 49,
60    SetSweepAttack = 50,
61    ApplyCombatHitSpell = 51,
62    ApplyBashingSpell = 52,
63    ApplyReanimateSpell = 53,
64    SetBooleanGraphVariable = 54,
65    ModSpellCastingSoundEvent = 55,
66    ModPickpocketChance = 56,
67    ModDetectionSneakSkill = 57,
68    ModFallingDamage = 58,
69    ModLockpickSweetSpot = 59,
70    ModSellPrices = 60,
71    CanPickpocketEquippedItem = 61,
72    ModLockpickLevelAllowed = 62,
73    SetLockpickStartingArc = 63,
74    SetProgressionPicking = 64,
75    MakeLockpicksUnbreakable = 65,
76    ModAlchemyEffectiveness = 66,
77    ApplyWeaponSwingSpell = 67,
78    ModCommandedActorLimit = 68,
79    ApplySneakingSpell = 69,
80    ModPlayerMagicSlowdown = 70,
81    ModWardMagickaAbsorptionPct = 71,
82    ModInitialIngredientEffectsLearned = 72,
83    PurifyAlchemyIngredients = 73,
84    FilterActivation = 74,
85    CanDualCastSpell = 75,
86    ModTemperingHealth = 76,
87    ModEnchantmentPower = 77,
88    ModSoulPctCapturedToWeapon = 78,
89    ModSoulGemEnchanting = 79,
90    ModNumberAppliedEnchantmentsAllowed = 80,
91    SetActivateLabel = 81,
92    ModShoutOK = 82,
93    ModPoisonDoseCount = 83,
94    ShouldApplyPlacedItem = 84,
95    ModArmorRating = 85,
96    ModLockpickingCrimeChance = 86,
97    ModIngredientsHarvested = 87,
98    ModSpellRange_TargetLoc = 88,
99    ModPotionsCreated = 89,
100    ModLockpickingKeyRewardChance = 90,
101    AllowMountActor = 91,
102}
103
104#[repr(C)]
105#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)]
106pub struct EntryPointParameter {
107    pub name: *const c_char, // 0x00
108    pub nonActor: bool,      // 0x08
109    pub pad09: u8,           // 0x09
110    pub pad0A: u16,          // 0x0A
111    pub pad0C: u32,          // 0x0C
112}
113const _: () = assert!(core::mem::size_of::<EntryPointParameter>() == 0x10);
114
115#[repr(C)]
116#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)]
117pub struct EntryPointParameters {
118    pub count: u32,                     // 0x00
119    pub pad04: u32,                     // 0x04
120    pub data: *mut EntryPointParameter, // 0x08
121}
122const _: () = assert!(core::mem::size_of::<EntryPointParameters>() == 0x10);
123
124#[repr(C)]
125#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)]
126pub struct EntryPoint {
127    pub name: *const c_char,                           // 0x00
128    pub parameters: EntryPointParameters,              // 0x08
129    pub functionType: ENTRY_POINT_FUNCTION_TYPE_CEnum, // 0x18
130    pub pad1C: u32,                                    // 0x1C
131}
132const _: () = assert!(core::mem::size_of::<EntryPoint>() == 0x20);
133
134// Equivalent to: static EntryPoint* GetEntryPoint(...)
135#[commonlibsse_ng_derive_internal::relocate(
136    cast_as = "*mut EntryPoint",
137    default = "None",
138    id(se = 675707, ae = 368994)
139)]
140#[inline]
141pub fn get_entry_point(entry_point: ENTRY_POINT) -> Option<NonNull<EntryPoint>> {
142    |as_type: AsType| unsafe { NonNull::new(as_type.add(entry_point as usize)) }
143}
144
145/// - Unsupported variadic args on Rust.
146///
147///   `ENTRY_POINT a_entryPoint, Actor* a_perkOwner, Args... a_args`
148///
149/// # Safety
150/// valid address
151///
152/// # Panics
153/// If invalid address.
154#[commonlibsse_ng_derive_internal::relocate_fn(se_id = 23073, ae_id = 23526)]
155pub unsafe fn handle_entry_point(entry_point: ENTRY_POINT, perk_owner: *mut Actor) {}